<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%  
    String path = request.getContextPath();  
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%> 
<script type="text/javascript">
     
    function queryUser(pageNum, pageSize) {
        window.location.href="<%=basePath%>user/list?page=" + pageNum + "&pageSize=" + pageSize;
    }
</script>
</head>
<body>
     
    <table>
       <tr><th>名字</th><th>密码</th><th>年龄</th></tr>
        <c:forEach items="${userList}" var="item">
            <tr><td>${item.userName}</td><td>${item.password}</td><td>${item.age}"</td></tr>
        </c:forEach>
     </table>
    <!-- 页数 -->
<div class="message">
    共<i class="blue">${pagehelper.total}</i>条记录，当前显示第&nbsp;<i
        class="blue">${pagehelper.pageNum}/${pagehelper.pages}</i>&nbsp;页
</div>
<div style="text-align:center;">
    <ul class="pagination">
        <!-- <li><a href="#">&laquo;</a></li> -->
        <c:if test="${!pagehelper.isFirstPage}">
            <li><a href="javascript:queryUser(${pagehelper.firstPage}, ${pagehelper.pageSize});">首页</a></li>
            <li><a href="javascript:queryUser(${pagehelper.prePage}, ${pagehelper.pageSize});">上一页</a></li>
        </c:if>
        <c:forEach items="${pagehelper.navigatepageNums}" var="navigatepageNum">
        
            <c:if test="${navigatepageNum==pagehelper.pageNum}">
                <li class="active"><a href="javascript:queryUser(${navigatepageNum}, ${pagehelper.pageSize});">${navigatepageNum}</a></li>
            </c:if>
            <c:if test="${navigatepageNum!=pagehelper.pageNum}">
                <li><a href="javascript:queryUser(${navigatepageNum}, ${pagehelper.pageSize});">${navigatepageNum}</a></li>
            </c:if>
        </c:forEach>
        <c:if test="${!pagehelper.isLastPage}">
            <li><a href="javascript:queryUser(${pagehelper.nextPage}, ${pagehelper.pageSize});">下一页</a></li>
            <li><a href="javascript:queryUser(${pagehelper.lastPage}, ${pagehelper.pageSize});">最后一页</a></li>
        </c:if>
    </ul>
</div>
     
</body>
</html>